#!/bin/bash
while true ;do

  proc_key="object_detection/train.py"
  proc_num=`ps -ef | grep "$proc_key" | grep -v "grep" | wc -l`
  if [ $proc_num -lt 1 ]; then
    echo "$proc_key stoped.system will be shutdown in 10m...." > while.log
    shutdown -h +10
    break
  else
    echo "$proc_key running..." > while.log
  fi
 
  sleep 10
done
